package com.service.Impl;

import com.entity.ReviewLikes;
import com.exception.AddException;
import com.mapper.ReviewLikesMapper;
import com.service.ReviewLikesService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName ReviewLikesServiceImpl
 * @Description 评论点赞业务层实现类
 * @Author Kx
 * @Date 2025/6/10 23:46
 * @Version 1.0
 */
@Service("reviewLikes")
public class ReviewLikesServiceImpl implements ReviewLikesService {
    private final ReviewLikesMapper reviewLikesMapper;

    public ReviewLikesServiceImpl(ReviewLikesMapper reviewLikesMapper) {
        this.reviewLikesMapper = reviewLikesMapper;
    }

    /**
     * @author: kx
     * @date: 2025/6/10 23:48
     * @param reviewLikes : 评论点赞信息
     * @description: 添加评论点赞信息
    */
    @Transactional // 开启事务
    @Override
    public void addReviewLikes(ReviewLikes reviewLikes) {
        try {
            reviewLikesMapper.addReviewLikes(reviewLikes);
        } catch (Exception e) {
            throw new AddException(1001,"添加评论点赞信息失败");
        }
    }
}
